import static org.junit.Assert.*;
import org.junit.Test;
import junit.framework.TestCase;
public class ComplexTest extends TestCase {
    Complex complex = new Complex(1, 1);
    //测试加法
    @Test
    public void testSub() {
        assertEquals(new Complex(-5.3, -2.4), complex.ComplexSub(new Complex(6.3, 3.4)));
        assertEquals(new Complex(-3.3, -1.1), complex.ComplexSub(new Complex(4.3, 2.1)));
    }

    //测试减法
    @Test
    public void testMulti() {
        assertEquals(new Complex(3.0, 2.0), complex.ComplexMulti(new Complex(3.0, 2.0)));
        assertEquals(new Complex(2.5, 4.3), complex.ComplexMulti(new Complex(2.5, 4.3)));
    }

    //测试乘法
    @Test
    public void testDiv() {
        assertEquals(new Complex(1.0, 1.0), complex.ComplexDiv(new Complex(1.0, 1.0)));
        assertEquals(new Complex(0.6, 0.2), complex.ComplexDiv(new Complex(2.0, 1.0)));
        //assertEquals(new Complex(0.0,0.0), complex.ComplexDiv(new Complex(3,4)));

    }
}
